﻿using System;
using System.Windows;
using System.Windows.Data;
using SoftSource.Timecard.Web.Data;

namespace SoftSource.Timecard.Converters
{
    public sealed class ProjectStatusToEditVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is ProjectStatus)
            {
                ProjectStatus projectStatus = (ProjectStatus)value;
                
                if (projectStatus.StatusID != ProjectStatus.Completed)
                {
                    return Visibility.Visible;
                }
            }

            return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
